#!/bin/sh
########################################################################
# Begin avahi
#
# Description : Avahi Boot Script
#
# Authors     : William Immendorf - will.immendorf@gmail.com
#               Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version     : LFS 7.2
#
########################################################################

### BEGIN INIT INFO
# Provides:            avahi
# Required-Start:      $syslog $local_fs $network
# Should-Start:        $remote_fs
# Required-Stop:       $network
# Should-Stop:         $remote_fs
# Default-Start:       3 4 5
# Default-Stop:        0 1 2 6
# Short-Description:   Service discovery on a local network
# Description:         Service discovery on a local network
# X-LFS-Provided-By:   BLFS / LFS 7.2
### END INIT INFO

. /lib/lsb/init-functions

case "${1}" in
   start)
      log_info_msg "Starting the Avahi Daemon"
      /usr/bin/avahi-daemon -D
      evaluate_retval

      log_info_msg "Starting the Avahi mDNS/DNS-SD Configuration Daemon"
      /usr/bin/avahi-dnsconfd -D
      evaluate_retval
      ;;

   stop)
      log_info_msg "Stopping the Avahi mDNS/DNS-SD Configuration Daemon"
      /usr/bin/avahi-dnsconfd -k
      evaluate_retval

      log_info_msg "Stopping the Avahi Daemon"
      /usr/bin/avahi-daemon -k
      evaluate_retval
      ;;

   reload)
      log_info_msg "Reloading the Avahi mDNS/DNS-SD Configuration Daemon"
      /usr/bin/avahi-dnsconfd -r
      evaluate_retval

      log_info_msg "Reloading the Avahi Daemon"
      /usr/bin/avahi-daemon -r
      evaluate_retval
      ;;

   restart)
      ${0} stop
      sleep 1
      ${0} start
      ;;

   status)
      statusproc avahi-daemon
      statusproc avahi-dnsconfd
      ;;

   *)
      echo "Usage: ${0} {start|stop|reload|restart|status}"
      exit 1
      ;;
esac

# End /etc/init.d/avahi
